package com.lin.linchatgpt.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.mybatisflex.core.keygen.KeyGenerators;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 *  实体类。
 *
 * @author 15898
 * @since 2023-06-13
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "chat_user")
public class User implements Serializable {

    /**
     * 用户主键
     */
    @Id(keyType = KeyType.Generator,value = KeyGenerators.uuid)
    private String id;

    /**
     * 用户名
     */
    private String username;

    /**
     * 用户邮箱
     */
    private String email;

    /**
     * 用户密码
     */
    @JsonIgnore
    private String password;

    /**
     * 用户头像
     */
    private String avatar;

    /**
     * 用户状态
     * 0：邮箱未认证，1：正常，2：禁用
     */
    private Integer status;

    /**
     * 逻辑删除
     */
    @Column(isLogicDelete = true)
    @JsonIgnore
    private Integer isDeleted;

    /**
     * 创建时间
     */
    @Column(onInsertValue = "now()")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime creatTime;

    /**
     * 修改时间
     */
    @Column(onUpdateValue = "now()")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime modifyTime;

}
